﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Person.DS;
using Person;

namespace Tests
{
    [TestFixture]
    public class UT_Factory
    {
        private static object[] myTestCaseParam =
            {
               new object[]{"csv","D:\\2012\\HW\\HW9\\InheritanceWithFabric\\Files\\furnitureCSV.csv",new DS_CSV()},
               new object[]{"db", @"Provider=SQLNCLI10.1;Data Source=JULIA-PC\MSSQLHEDGEHOG;Integrated Security=SSPI;Initial Catalog=MyPersona",new DS_DB()},
               new object[]{"mock", @"D:\2012\HW\HW9\InheritanceWithFabric\Files\furnitureCSV.txt",null} 
            };

        [Test, TestCaseSource("myTestCaseParam")]
        public void UTFactory(string _ext, string path, IPerson expected)
        {
            IPerson actual = Factory.GetInstance(_ext, path);
            if (expected != null && actual != null)
                Assert.AreEqual(expected.GetType().Name, actual.GetType().Name);
            else
                Assert.AreEqual(expected, actual);
        }
    }
}
